<?php
/**
* 
*/
class Text extends IController{
	
public function add(){
	$this->redirect("add");

	}




public function town(){
	$address=$_POST["name"];
	$ak="HNmzxMNkSOx0fFcLekUh00s0nYE3VKx2";
	$url="http://api.map.baidu.com/geocoder/v2/?address=$address&output=json&ak=$ak";
	$data=file_get_contents($url);
	$data=json_decode($data,true);
	$lng=$data["result"]["location"]["lng"];
	$lat=$data["result"]["location"]["lat"];
	$arr=array("lng"=>$lng,"lat"=>$lat);
	echo json_encode($arr);
}



}






?>